<?php
class Address_model extends CI_Model {

	/**
	 * @author Pwint Phyu Shwe
	 * Address Model for property_address
	 * Saving property address for advertisement
	 * Refer detail in each function's comment section below.
	 */
	// table name
	private $tbl_address = 'property_address';

	function __construct()
	{
		// Call the Model constructor
		parent::__construct();
	}
	// get number of users in database
	function count_all(){
		return $this->db->count_all($this->tbl_address);
	}	
	// get address by addressID
	function get_by_id($addrID){
		$this->db->where('addressID', $addrID);
		return $this->db->get($this->tbl_address);
	}
	// add new address
	function save($address){
		$this->db->insert($this->tbl_address, $address);
		return $this->db->insert_id();
	}
	// update person by addressID
	function update($addrID, $address){
		$this->db->where('addressID', $address);
		$this->db->update($this->$tbl_address, $address);
	}
	// delete person by addressID
	function delete($addrID){
		$this->db->where('addressID', $addrID);
		$this->db->delete($this->$tbl_address);
	}
}
?>